package com.flute.tools.sql;

public class DeleteSQL implements ISQL {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2945644236668850194L;
	private SQLTable tables;
	private WhereSQL where;

	public DeleteSQL() {
		this.tables = new SQLTable();
		this.where = new WhereSQL();
	}

	public void addTable(String table) {
		this.tables.addTable(table);
	}

	public void addWhereCondition(String field, String value) {
		this.where.addCondition(field, value);
	}

	@Override
	public String getSQLString() {
		StringBuffer sb = new StringBuffer();
		sb.append("delete from ");
		sb.append(tables.getSQLString());
		sb.append(where.getSQLString());

		return SQLUtils.removeMultiBlank(sb.toString());
	}

}
